/*
 *    This file is part of SSHTunneler.
 *
 *    Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
 *
 *    SSHTunneler is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    SSHTunneler is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with SSHTunneler.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package sshtunneler.license;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class ShowLicense extends javax.swing.JDialog implements ActionListener {
	private static final long serialVersionUID = -3858042802035293667L;
	private JScrollPane jScrollPane;
	private JTextArea text;
	private JButton cmd_close;
	private JPanel panel_cmd;

	private ResourceBundle license_resourceMap;

	public ShowLicense() {
		this.license_resourceMap = ResourceBundle
				.getBundle("sshtunneler.license.license");

		this.setModal(true);
		this.setTitle("Licensing information ...");
		this.setLayout(new BorderLayout());
		this.setPreferredSize(new Dimension(600, 400));
		this.setLocationByPlatform(true);

		this.jScrollPane = new JScrollPane();
		this.text = new JTextArea();
		this.cmd_close = new JButton("Close");
		this.panel_cmd = new JPanel();
		this.panel_cmd.setLayout(new BorderLayout());

		this.cmd_close.addActionListener(this);

		this.panel_cmd.add(this.cmd_close, BorderLayout.CENTER);

		this.add(this.jScrollPane, BorderLayout.CENTER);
		this.add(this.panel_cmd, BorderLayout.SOUTH);

		this.jScrollPane.getViewport().add(this.text);
		this.pack();

		this.text.setEditable(false);
		this.text.setText(this.license_resourceMap.getString("license"));
	}

	public void actionPerformed(ActionEvent e) {
		this.setVisible(false);
	}
}
